﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<ChoViet.Model.Menu>>" %>
<div id="nav">
    <ul>
      <%string cClass = "current";
        var cUrl = Request.Url.PathAndQuery;
      foreach( var m in Model){
          var current = cUrl == m.NavigateUrl ? cClass : string.Empty;
          %>
        <li ><a class="<%=current%>" href="<%=m.NavigateUrl %>"><%=Html.Encode(m.Name) %></a>
            <%var childs = m.ChildMenu.Where(e => e.PubYN == true).ToList();
              if (childs.Count > 0)
              { %>
              <ul>
                <%foreach (var c in m.ChildMenu)
                  {
                      var childcurrent = cUrl == c.NavigateUrl ? cClass : string.Empty;
                      %>
                  <li><a class="<%=childcurrent%>" href="<%=c.NavigateUrl %>"><%=Html.Encode(c.Name) %></a></li>
                <%} %>
              </ul>
          <%} %>
        </li>
      <%} %>      
    </ul>
 </div>
 <div class="clear"></div>
